<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        
        
        <link rel="stylesheet" type="text/css" href="css/easyui.css">
        <link rel="stylesheet" type="text/css" href="css/icon.css">
        <script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>

        <script type="text/javascript">
            tinyMCE.init({
                // General options
                height: "500",
                width: "100%",
                mode : "textareas",
                theme : "advanced",
                plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",

                // Theme options
                //                    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
                //                    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                //                    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
                theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
                theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,link,unlink,image,|,forecolor,backcolor,|,tablecontrols,|,hr,removeformat,|,sub,sup,|,charmap",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : true,

                // Example content CSS (should be your site CSS)
                content_css : "../css/content.css",
                extended_valid_elements : "hr[class|width|size|noshade]",
                file_browser_callback : "ajaxfilemanager",
                paste_use_dialog : false,
                theme_advanced_resize_horizontal : true,
                apply_source_formatting : true,
                force_br_newlines : true,
                force_p_newlines : false,
                relative_urls : false,
                remove_script_host : true
                //document_base_url : "http://http://127.0.0.1:8080/ATS/source",
                //document_base_url : "/ATS/source",
            });

            function ajaxfilemanager(field_name, url, type, win) {
                var view = 'thumbnail';
                var ajaxfilemanagerurl = "../js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php?view=" + view;
                
                //window.open(ajaxfilemanagerurl);
                switch (type) {
                    case "image":
                        break;
                    case "media":
                        break;
                    case "flash":
                        break;
                    case "file":
                        break;
                    default:
                        return false;
                }
                
                var fileBrowserWindow = new Array();
                fileBrowserWindow["file"] = ajaxfilemanagerurl;
                fileBrowserWindow["title"] = "Ajax File Manager";
                fileBrowserWindow["width"] = "782";
                fileBrowserWindow["height"] = "440";
                fileBrowserWindow["close_previous"] = "no";

                tinyMCE.activeEditor.windowManager.open({
                    url: ajaxfilemanagerurl,// "../js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php?view=" + view,
                    width: 782,
                    height: 440,
                    inline : "yes",
                    close_previous : "no"
                },{
                    window : win,
                    input : field_name
                });
                return false;
            }
            
            function saveData() {
                $("#ff").submit();
            }

            $(function(){
                $('#ff').form({
                    onSubmit:function(){
                        return $(this).form('validate');  
                    },  
                    success:function(data){
                        $.messager.alert('Info', data, 'info');
                        clearForm();
                    }
                });
            });
            
            $(document).ready(function () { 
                clearForm();
            });
            
            function clearForm() {
                $("#name").val('');
                $("#email").val('');
                $("#subject").val('');
                $("#message").val('');
            }
        </script>

    </head>
    <body>
        <?php
        include 'header.php';

        include 'inc/conn.php';
        $sql = "select * from ats_content where id=1";
        $rs = mysql_query($sql);

        while ($row = mysql_fetch_row($rs)) {
            $items = $row;
        }
        ?>
        <h2>ABOUT US</h2>
        <form id="ff" action="aboutus_update.php" method="post">  
            <textarea id="txtcontent" name="txtcontent" rows="2" cols="20">
                <?php echo $items[1]; ?>
            </textarea>
        </form>

        <div id="dlg-buttons">
            <a href="#"
               class="easyui-linkbutton"
               iconCls="icon-ok"
               onclick="saveData();">Save</a>
        </div>
        
        <?php ob_end_flush(); ?>
    </body>
</html>